<?php
require('config.php');

        $tiezi_id=$_REQUEST['tiezi_id'];
		//$tiezi_id=50;
		$sql="select ".$oto."_posts_comment.*,".$oto."_users.userName,".$oto."_users.userPhoto from `".$oto."_posts_comment`,`".$oto."_users` where `psId`='".$tiezi_id."' and ".$oto."_posts_comment.userId=".$oto."_users.userId and ".$oto."_posts_comment.status='1' and ".$oto."_posts_comment.isDel='0' and ".$oto."_posts_comment.pid='0' order by floor ASC";
		$result=$db->query($sql);
		while($row=$result->fetch_assoc()){
			$tiezi_pinglun_info[]=$row;//将取得的所有数据赋值给person_info数组
		}
		if(isset($tiezi_pinglun_info))
		{
			for($i=0;$i<count($tiezi_pinglun_info);$i++)
			{
				$id=$tiezi_pinglun_info[$i]['id'];
				$sql="select ".$oto."_posts_comment.*,".$oto."_users.userName,".$oto."_users.userPhoto from `".$oto."_posts_comment`,`".$oto."_users` where `psId`='".$tiezi_id."' and ".$oto."_posts_comment.userId=".$oto."_users.userId and ".$oto."_posts_comment.status='1' and ".$oto."_posts_comment.isDel='0' and ".$oto."_posts_comment.pid='{$id}' order by `time` ASC";
				$result=$db->query($sql);
				while($row=$result->fetch_assoc()){
					$min_pinglun_info[$i][]=$row;//将取得的所有数据赋值给person_info数组
				}
				if(isset($min_pinglun_info[$i]))
				{
					for($j=0;$j<count($min_pinglun_info[$i]);$j++)
					{
						$tiezi_pinglun_info[$i]['min_pinglun'][$j]=$min_pinglun_info[$i][$j];
					}
				}
				else
				{
					$tiezi_pinglun_info[$i]['min_pinglun']="null";
				}
			}
			echo json_encode($tiezi_pinglun_info);
		}
		else
		{
			echo "null";
		}
?>